package gwtappcontainer.server.apis.admin;
import gwtappcontainer.shared.apis.admin.RoleProp;
import gwtappcontainer.shared.apis.admin.UserProp;
import java.util.ArrayList;
import java.util.List;
import com.googlecode.objectify.Ref;
import com.googlecode.objectify.annotation.Cache;
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;
import com.googlecode.objectify.annotation.Load;
@Entity @Cache
public class UserEntity {
@Id Long id;
@Index String email;
@Load List<Ref<RoleEntity>> roles;
public UserProp toProp() {
UserProp prop = new UserProp();
prop.id = id;
prop.email = email;
prop.roles = new ArrayList<RoleProp>();
if (null != roles) {
for (Ref<RoleEntity> entity : roles) {
prop.roles.add(entity.get().toProp());
}
}
return prop;
}
}